<?php

/**
 * SigmaCMS - Content Management System
 *
 * Copyright (C) 2008 Pavol Biely
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    SigmaCMS
 * @author     Pavol Biely <pavolbiely@gmail.com>
 * @copyright  2008 Pavol Biely
 * @license    http://www.gnu.org/licenses/gpl.txt   GNU General Public License
 * @link       http://pabi3.com/
 * @since      0.1.0
 */

final class i18n
{
	/**
	 * Include the language file
	 *
	 * @return void
	 */
	static public function language()
	{
		// language abbreviation
		$lang = cfg::get('language');

		// path to language file
		$langPath = dirname(__FILE__).'/../'.cfg::DIR_LANGS.$lang.'.php';

		// does the file exist?
		if (file_exists($langPath)) {
			include_once $langPath;
		} else {
			throw new Sigma_Exception("Language file not found (".$langPath.")");
		}
	}

	/**
	 * Cache of languages
	 *
	 * @var array
	 */
	static private $languages = array();

	/**
	 * Get a language abbreviation by its ID
	 *
	 * @param integer $id
	 * @return string
	 */
	static public function getLangByID($id)
	{
		// only numeric keys are allowed
		$id = (integer) $id;

		// already stored in the cache?
		if (isset(self::$languages[$id])) {
			return self::$languages[$id];
		}

		// load into the cache
		$sql = db::query("SELECT `id`, `lang` FROM %t", "languages");
		while ($row = db::fetchObject($sql)) {
			self::$languages[$row->id] = $row->lang;
			self::$languages[$row->lang] = $row->id;
		}
		db::free($sql);

		return (string) self::$languages[$id];
	}

	/**
	 * Get a language ID by its abbreviation
	 *
	 * @param string $lang
	 * @return integer
	 */
	static public function getLangId($lang)
	{
		// only string keys are allowed
		$lang = (string) $lang;

		// already stored in the cache?
		if (isset(self::$languages[$lang])) {
			return self::$languages[$lang];
		}

		// load into the cache
		$sql = db::query("SELECT `id`, `lang` FROM %t", "languages");
		while ($row = db::fetchObject($sql)) {
			self::$languages[$row->id] = $row->lang;
			self::$languages[$row->lang] = $row->id;
		}
		db::free($sql);

		return (integer) self::$languages[$lang];
	}

	/**
	 * Print the XHTML element <select> with available languages
	 *
	 * @param array $params
	 * @param mixed $selected
	 * @param array $exclude
	 * @param boolean $idInValues
	 * @return void
	 */
	static public function getLangSelector(array $params = array(), $selected = NULL, array $exclude = array(), $idInValues = true)
	{
		// <select> element with parameters
		echo "<select";
		foreach ($params as $key => $value) {
			echo " "._hsc($key)."='"._hsc($value)."'";
		}
		echo ">\n";

		// array of all languages
		$languages = self::getLanguages();

		// load installed languages
		$sql = db::query("SELECT `id`,`lang` FROM ".db::prefix('languages')." ORDER BY `lang` ASC");
		while ($row = db::fetchObject($sql)) {
			// skip languages
			if (in_array($row->id,$exclude)) {
				continue;
			}

			// ID in parameter value?
			if ($idInValues) {
				echo "<option value='{$row->id}'".($row->id==$selected ? " selected='selected'" : NULL).">".$languages[$row->lang]."</option>\n";
			} else {
				echo "<option value='{$row->lang}'".($row->lang==$selected ? " selected='selected'" : NULL).">".$languages[$row->lang]."</option>\n";
			}
		}
		db::free($sql);

		echo "</select>\n";
	}

	/**
	 * Countries by ISO-3166-1
	 *
	 * @link http://en.wikipedia.org/wiki/ISO_3166-1
	 * @return array
	 */
	static public function getCountries()
	{
		static $countries = array(
		'AF' => 'Afghanistan',
		'AX' => 'Åland Islands',
		'AL' => 'Albania',
		'DZ' => 'Algeria',
		'AS' => 'American Samoa',
		'AD' => 'Andorra',
		'AO' => 'Angola',
		'AI' => 'Anguilla',
		'AQ' => 'Antarctica',
		'AG' => 'Antigua and Barbuda',
		'AR' => 'Argentina',
		'AM' => 'Armenia',
		'AW' => 'Aruba',
		'AU' => 'Australia',
		'AT' => 'Austria',
		'AZ' => 'Azerbaijan',
		
		'BS' => 'Bahamas',
		'BH' => 'Bahrain',
		'BD' => 'Bangladesh',
		'BB' => 'Barbados',
		'BY' => 'Belarus',
		'BE' => 'Belgium',
		'BZ' => 'Belize',
		'BJ' => 'Benin',
		'BM' => 'Bermuda',
		'BT' => 'Bhutan',
		'BO' => 'Bolivia',
		'BA' => 'Bosnia and Herzegovina',
		'BW' => 'Botswana',
		'BV' => 'Bouvet Island',
		'BR' => 'Brazil',
		'IO' => 'British Indian Ocean Territory',
		'BN' => 'Brunei Darussalam',
		'BG' => 'Bulgaria',
		'BF' => 'Burkina Faso',
		'BI' => 'Burundi',
		
		'KH' => 'Cambodia',
		'CM' => 'Cameroon',
		'CA' => 'Canada',
		'CV' => 'Cape Verde',
		'KY' => 'Cayman Islands',
		'CF' => 'Central African Republic',
		'TD' => 'Chad',
		'CL' => 'Chile',
		'CN' => 'China',
		'CX' => 'Christmas Island',
		'CC' => 'Cocos (Keeling) Islands',
		'CO' => 'Colombia',
		'KM' => 'Comoros',
		'CG' => 'Congo',
		'CD' => 'Congo, the Democratic Republic of the',
		'CK' => 'Cook Islands',
		'CR' => 'Costa Rica',
		'CI' => 'Côte d\'Ivoire',
		'HR' => 'Croatia',
		'CU' => 'Cuba',
		'CY' => 'Cyprus',
		'CZ' => 'Czech Republic',
		
		'DK' => 'Denmark',
		'DJ' => 'Djibouti',
		'DM' => 'Dominica',
		'DO' => 'Dominican Republic',
		
		'EC' => 'Ecuador',
		'EG' => 'Egypt',
		'SV' => 'El Salvador',
		'GQ' => 'Equatorial Guinea',
		'ER' => 'Eritrea',
		'EE' => 'Estonia',
		'ET' => 'Ethiopia',
		
		'FK' => 'Falkland Islands (Malvinas)',
		'FO' => 'Faroe Islands',
		'FJ' => 'Fiji',
		'FI' => 'Finland',
		'FR' => 'France',
		'GF' => 'French Guiana',
		'PF' => 'French Polynesia',
		'TF' => 'French Southern Territories',
		
		'GA' => 'Gabon',
		'GM' => 'Gambia',
		'GE' => 'Georgia',
		'DE' => 'Germany',
		'GH' => 'Ghana',
		'GI' => 'Gibraltar',
		'GR' => 'Greece',
		'GL' => 'Greenland',
		'GD' => 'Grenada',
		'GP' => 'Guadeloupe',
		'GU' => 'Guam',
		'GT' => 'Guatemala',
		'GG' => 'Guernsey',
		'GN' => 'Guinea',
		'GW' => 'Guinea-Bissau',
		'GY' => 'Guyana',
		
		'HT' => 'Haiti',
		'HM' => 'Heard Island and McDonald Islands',
		'VA' => 'Holy See (Vatican City State)',
		'HN' => 'Honduras',
		'HK' => 'Hong Kong',
		'HU' => 'Hungary',
		
		'IS' => 'Iceland',
		'IN' => 'India',
		'ID' => 'Indonesia',
		'IR' => 'Iran, Islamic Republic of',
		'IQ' => 'Iraq',
		'IE' => 'Ireland',
		'IM' => 'Isle of Man',
		'IL' => 'Israel',
		'IT' => 'Italy',
		
		'JM' => 'Jamaica',
		'JP' => 'Japan',
		'JE' => 'Jersey',
		'JO' => 'Jordan',
		
		'KZ' => 'Kazakhstan',
		'KE' => 'Kenya',
		'KI' => 'Kiribati',
		'KP' => 'Korea, Democratic People\'s Republic of',
		'KR' => 'Korea, Republic of',
		'KW' => 'Kuwait',
		'KG' => 'Kyrgyzstan',
		
		'LA' => 'Lao People\'s Democratic Republic',
		'LV' => 'Latvia',
		'LB' => 'Lebanon',
		'LS' => 'Lesotho',
		'LR' => 'Liberia',
		'LY' => 'Libyan Arab Jamahiriya',
		'LI' => 'Liechtenstein',
		'LT' => 'Lithuania',
		'LU' => 'Luxembourg',
		
		'MO' => 'Macao',
		'MK' => 'Macedonia, the former Yugoslav Republic of',
		'MG' => 'Madagascar',
		'MW' => 'Malawi',
		'MY' => 'Malaysia',
		'MV' => 'Maldives',
		'ML' => 'Mali',
		'MT' => 'Malta',
		'MH' => 'Marshall Islands',
		'MQ' => 'Martinique',
		'MR' => 'Mauritania',
		'MU' => 'Mauritius',
		'YT' => 'Mayotte',
		'MX' => 'Mexico',
		'FM' => 'Micronesia, Federated States of',
		'MD' => 'Moldova, Republic of',
		'MC' => 'Monaco',
		'MN' => 'Mongolia',
		'ME' => 'Montenegro',
		'MS' => 'Montserrat',
		'MA' => 'Morocco',
		'MZ' => 'Mozambique',
		'MM' => 'Myanmar',
		
		'NA' => 'Namibia',
		'NR' => 'Nauru',
		'NP' => 'Nepal',
		'NL' => 'Netherlands',
		'AN' => 'Netherlands Antilles',
		'NC' => 'New Caledonia',
		'NZ' => 'New Zealand',
		'NI' => 'Nicaragua',
		'NE' => 'Niger',
		'NG' => 'Nigeria',
		'NU' => 'Niue',
		'NF' => 'Norfolk Island',
		'MP' => 'Northern Mariana Islands',
		'NO' => 'Norway',
		
		'OM' => 'Oman',
		
		'PK' => 'Pakistan',
		'PW' => 'Palau',
		'PS' => 'Palestinian Territory, Occupied',
		'PA' => 'Panama',
		'PG' => 'Papua New Guinea',
		'PY' => 'Paraguay',
		'PE' => 'Peru',
		'PH' => 'Philippines',
		'PN' => 'Pitcairn',
		'PL' => 'Poland',
		'PT' => 'Portugal',
		'PR' => 'Puerto Rico',
		
		'QA' => 'Qatar',
		
		'RE' => 'Réunion',
		'RO' => 'Romania',
		'RU' => 'Russian Federation',
		'RW' => 'Rwanda',
		
		'SH' => 'Saint Helena',
		'KN' => 'Saint Kitts and Nevis',
		'LC' => 'Saint Lucia',
		'PM' => 'Saint Pierre and Miquelon',
		'VC' => 'Saint Vincent and the Grenadines',
		'WS' => 'Samoa',
		'SM' => 'San Marino',
		'ST' => 'Sao Tome and Principe',
		'SA' => 'Saudi Arabia',
		'SN' => 'Senegal',
		'RS' => 'Serbia',
		'SC' => 'Seychelles',
		'SL' => 'Sierra Leone',
		'SG' => 'Singapore',
		'SK' => 'Slovakia',
		'SI' => 'Slovenia',
		'SB' => 'Solomon Islands',
		'SO' => 'Somalia',
		'ZA' => 'South Africa',
		'GS' => 'South Georgia and the South Sandwich Islands',
		'ES' => 'Spain',
		'LK' => 'Sri Lanka',
		'SD' => 'Sudan',
		'SR' => 'Suriname',
		'SJ' => 'Svalbard and Jan Mayen',
		'SZ' => 'Swaziland',
		'SE' => 'Sweden',
		'CH' => 'Switzerland',
		'SY' => 'Syrian Arab Republic',
		
		'TW' => 'Taiwan, Province of China',
		'TJ' => 'Tajikistan',
		'TZ' => 'Tanzania, United Republic of',
		'TH' => 'Thailand',
		'TL' => 'Timor-Leste',
		'TG' => 'Togo',
		'TK' => 'Tokelau',
		'TO' => 'Tonga',
		'TT' => 'Trinidad and Tobago',
		'TN' => 'Tunisia',
		'TR' => 'Turkey',
		'TM' => 'Turkmenistan',
		'TC' => 'Turks and Caicos Islands',
		'TV' => 'Tuvalu',
		
		'UG' => 'Uganda',
		'UA' => 'Ukraine',
		'AE' => 'United Arab Emirates',
		'GB' => 'United Kingdom',
		'US' => 'United States',
		'UM' => 'United States Minor Outlying Islands',
		'UY' => 'Uruguay',
		'UZ' => 'Uzbekistan',
		
		'VU' => 'Vanuatu',
		'VE' => 'Venezuela',
		'VN' => 'Viet Nam',
		'VG' => 'Virgin Islands, British',
		'VI' => 'Virgin Islands, U.S.',
		
		'WF' => 'Wallis and Futuna',
		'EH' => 'Western Sahara',
		
		'YE' => 'Yemen',
		
		'ZM' => 'Zambia',
		'ZW' => 'Zimbabwe');
		
		return $countries;
	}

	/**
	 * Languages by ISO 639-1
	 * 
	 * @link http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
	 * @return array
	 */
	static public function getLanguages()
	{
		static $languages = array(
		'aa' => 'Afar',
		'ab' => 'Abkhazian',
		'ae' => 'Avestan',
		'af' => 'Afrikaans',
		'ak' => 'Akan',
		'am' => 'Amharic',
		'an' => 'Aragonese',
		'ar' => 'Arabic',
		'as' => 'Assamese',
		'av' => 'Avaric',
		'ay' => 'Aymara',
		'az' => 'Azerbaijani',
		'ba' => 'Bashkir',
		'be' => 'Belarusian',
		'bg' => 'Bulgarian',
		'bh' => 'Bihari',
		'bi' => 'Bislama',
		'bm' => 'Bambara',
		'bn' => 'Bengali',
		'bo' => 'Tibetan',
		'br' => 'Breton',
		'bs' => 'Bosnian',
		'ca' => 'Catalan',
		'ce' => 'Chechen',
		'ch' => 'Chamorro',
		'co' => 'Corsican',
		'cr' => 'Cree',
		'cs' => 'Čeština',
		'cu' => 'Church',
		'cv' => 'Chuvash',
		'cy' => 'Welsh',
		'da' => 'Danish',
		'de' => 'German',
		'dv' => 'Divehi',
		'dz' => 'Dzongkha',
		'ee' => 'Ewe',
		'el' => 'Greek',
		'en' => 'English',
		'eo' => 'Esperanto',
		'es' => 'Spanish',
		'et' => 'Estonian',
		'eu' => 'Basque',
		'fa' => 'Persian',
		'ff' => 'Fulah',
		'fi' => 'Finnish',
		'fj' => 'Fijian',
		'fo' => 'Faroese',
		'fr' => 'French',
		'fy' => 'Western Frisian',
		'ga' => 'Irish',
		'gd' => 'Scottish Gaelic',
		'gl' => 'Galician',
		'gn' => 'Guaraní',
		'gu' => 'Gujarati',
		'gv' => 'Manx',
		'ha' => 'Hausa',
		'he' => 'Hebrew',
		'hi' => 'Hindi',
		'ho' => 'Hiri Motu',
		'hr' => 'Croatian',
		'ht' => 'Haitian',
		'hu' => 'Hungarian',
		'hy' => 'Armenian',
		'hz' => 'Herero',
		'ia' => 'Interlingua',
		'id' => 'Indonesian',
		'ie' => 'Interlingue',
		'ig' => 'Igbo',
		'ii' => 'Sichuan Yi',
		'ik' => 'Inupiaq',
		'io' => 'Ido',
		'is' => 'Icelandic',
		'it' => 'Italian',
		'iu' => 'Inuktitut',
		'ja' => 'Japanese',
		'jv' => 'Javanese',
		'ka' => 'Georgian',
		'kg' => 'Kongo',
		'ki' => 'Kikuyu',
		'kj' => 'Kuanyama',
		'kk' => 'Kazakh',
		'kl' => 'Kalaallisut',
		'km' => 'Khmer',
		'kn' => 'Kannada',
		'ko' => 'Korean',
		'kr' => 'Kanuri',
		'ks' => 'Kashmiri',
		'ku' => 'Kurdish',
		'kv' => 'Komi',
		'kw' => 'Cornish',
		'ky' => 'Kirghiz',
		'la' => 'Latin',
		'lb' => 'Luxembourgish',
		'lg' => 'Ganda',
		'li' => 'Limburgish',
		'ln' => 'Lingala',
		'lo' => 'Lao',
		'lt' => 'Lithuanian',
		'lu' => 'Luba-Katanga',
		'lv' => 'Latvian',
		'mg' => 'Malagasy',
		'mh' => 'Marshallese',
		'mi' => 'Māori',
		'mk' => 'Macedonian',
		'ml' => 'Malayalam',
		'mn' => 'Mongolian',
		'mo' => 'Moldavian',
		'mr' => 'Marathi',
		'ms' => 'Malay',
		'mt' => 'Maltese',
		'my' => 'Burmese',
		'na' => 'Nauru',
		'nb' => 'Norwegian Bokmål',
		'nd' => 'North Ndebele',
		'ne' => 'Nepali',
		'ng' => 'Ndonga',
		'nl' => 'Dutch',
		'nn' => 'Norwegian',
		'no' => 'Norwegian',
		'nr' => 'South Ndebele',
		'nv' => 'Navajo',
		'ny' => 'Chichewa',
		'oc' => 'Occitan',
		'oj' => 'Ojibwa',
		'om' => 'Oromo',
		'or' => 'Oriya',
		'os' => 'Ossetian',
		'pa' => 'Panjabi',
		'pi' => 'Pāli',
		'pl' => 'Polish',
		'ps' => 'Pashto',
		'pt' => 'Portuguese',
		'qu' => 'Quechua',
		'rm' => 'Raeto-Romance',
		'rn' => 'Kirundi',
		'ro' => 'Romanian',
		'ru' => 'Russian',
		'rw' => 'Kinyarwanda',
		'sa' => 'Sanskrit',
		'sc' => 'Sardinian',
		'sd' => 'Sindhi',
		'se' => 'Northern Sami',
		'sg' => 'Sango',
		'sh' => 'Serbo-Croatian',
		'si' => 'Sinhalese',
		'sk' => 'Slovak',
		'sl' => 'Slovenian',
		'sm' => 'Samoan',
		'sn' => 'Shona',
		'so' => 'Somali',
		'sq' => 'Albanian',
		'sr' => 'Serbian',
		'ss' => 'Swati',
		'st' => 'Sotho',
		'su' => 'Sundanese',
		'sv' => 'Swedish',
		'sw' => 'Swahili',
		'ta' => 'Tamil',
		'te' => 'Telugu',
		'tg' => 'Tajik',
		'th' => 'Thai',
		'ti' => 'Tigrinya',
		'tk' => 'Turkmen',
		'tl' => 'Tagalog',
		'tn' => 'Tswana',
		'to' => 'Tonga',
		'tr' => 'Turkish',
		'ts' => 'Tsonga',
		'tt' => 'Tatar',
		'tw' => 'Twi',
		'ty' => 'Tahitian',
		'ug' => 'Uighur',
		'uk' => 'Ukrainian',
		'ur' => 'Urdu',
		'uz' => 'Uzbek',
		've' => 'Venda',
		'vi' => 'Vietnamese',
		'vo' => 'Volapük',
		'wa' => 'Walloon',
		'wo' => 'Wolof',
		'xh' => 'Xhosa',
		'yi' => 'Yiddish',
		'yo' => 'Yoruba',
		'za' => 'Zhuang',
		'th' => 'Chinese',
		'zu' => 'Zulu'
		);

		return $languages;
	}

	/**
	 * Telephone numbering plan
	 *
	 * @return array
	 */
	static public function getDialingCodes()
	{
		static $dialCodes = array(
		'AF' => '+93',
		'AL' => '+355',
		'DZ' => '+213',
		'AS' => '+1',
		'AD' => '+376',
		'AO' => '+244',
		'AI' => '+1',
		'AQ' => '+672',
		'AG' => '+1',
		'AR' => '+54',
		'AM' => '+374',
		'AW' => '+297',
		'AU' => '+61',
		'AT' => '+43',
		'AZ' => '+994',
		'BS' => '+1',
		'BH' => '+973',
		'BD' => '+880',
		'BB' => '+1',
		'BY' => '+375',
		'BE' => '+32',
		'BZ' => '+501',
		'BJ' => '+229',
		'BM' => '+1',
		'BT' => '+975',
		'BO' => '+591',
		'BA' => '+387',
		'BW' => '+267',
		//'BV' => '',
		'BR' => '+55',
		'IO' => '+246',
		'BN' => '+673',
		'BG' => '+359',
		'BF' => '+226',
		'BI' => '+257',
		'KH' => '+855',
		'CM' => '+237',
		'CA' => '+1',
		'CV' => '+238',
		'KY' => '+1',
		'CF' => '+236',
		'TD' => '+235',
		'CL' => '+56',
		'CN' => '+86',
		'CX' => '+672',
		'CC' => '+672',
		'CO' => '+57',
		'KM' => '+269',
		'CG' => '+242',
		'CD' => '+243',
		'CK' => '+682',
		'CR' => '+506',
		'CI' => '+225',
		'HR' => '+385',
		'CU' => '+53',
		'CY' => '+357',
		'CZ' => '+420',
		'DK' => '+45',
		'DJ' => '+253',
		'DM' => '+1',
		'DO' => '+1',
		'TP' => '+670',
		'EC' => '+593',
		'EG' => '+20',
		'SV' => '+503',
		'GQ' => '+240',
		'ER' => '+291',
		'EE' => '+372',
		'ET' => '+251',
		'FK' => '+500',
		'FO' => '+298',
		'FJ' => '+679',
		'FI' => '+358',
		'FR' => '+33',
		'GF' => '+594',
		'PF' => '+689',
		//'TF' => '',
		'GA' => '+24',
		'GM' => '+220',
		'GE' => '+995',
		'DE' => '+49',
		'GH' => '+233',
		'GI' => '+350',
		'GR' => '+30',
		'GL' => '+299',
		'GD' => '+1',
		'GP' => '+590',
		'GU' => '+1',
		'GT' => '+502',
		'GN' => '+224',
		'GW' => '+245',
		'GY' => '+592',
		'HT' => '+509',
		'HM' => '+672',
		'VA' => '+379',
		'HN' => '+504',
		'HK' => '+852',
		'HU' => '+36',
		'IS' => '+354',
		'IN' => '+91',
		'ID' => '+62',
		'IR' => '+98',
		'IQ' => '+964',
		'IE' => '+353',
		'IL' => '+972',
		'IT' => '+39',
		'JM' => '+1',
		'JP' => '+81',
		'JO' => '+962',
		'KZ' => '+7',
		'KE' => '+254',
		'KI' => '+686',
		'KP' => '+850',
		'KR' => '+82',
		'KW' => '+965',
		'KG' => '+996',
		'LA' => '+856',
		'LV' => '+371',
		'LB' => '+961',
		'LS' => '+266',
		'LR' => '+231',
		'LY' => '+218',
		'LI' => '+423',
		'LT' => '+370',
		'LU' => '+352',
		'MO' => '+853',
		'MK' => '+389',
		'MG' => '+261',
		'MW' => '+265',
		'MY' => '+60',
		'MV' => '+960',
		'ML' => '+223',
		'MT' => '+356',
		'MH' => '+692',
		'MQ' => '+596',
		'MR' => '+222',
		'MU' => '+230',
		'YT' => '+269',
		'MX' => '+52',
		'FM' => '+691',
		'MD' => '+373',
		'MC' => '+377',
		'MN' => '+976',
		'ME' => '+382',
		'MS' => '+1',
		'MA' => '+212',
		'MZ' => '+258',
		'MM' => '+95',
		'NA' => '+264',
		'NR' => '+674',
		'NP' => '+977',
		'NL' => '+31',
		'AN' => '+599',
		'NC' => '+687',
		'NZ' => '+64',
		'NI' => '+505',
		'NE' => '+227',
		'NG' => '+234',
		'NU' => '+683',
		'NF' => '+672',
		'MP' => '+1',
		'NO' => '+47',
		'OM' => '+968',
		'PK' => '+92',
		'PW' => '+680',
		'PS' => '+970',
		'PA' => '+507',
		'PG' => '+675',
		'PY' => '+595',
		'PE' => '+51',
		'PH' => '+63',
		'PN' => '+649',
		'PL' => '+48',
		'PT' => '+351',
		'PR' => '+1',
		'QA' => '+974',
		'RE' => '+262',
		'RO' => '+40',
		'RU' => '+7',
		'RW' => '+250',
		'SH' => '+290',
		'KN' => '+1',
		'LC' => '+1',
		'PM' => '+508',
		'VC' => '+1',
		'WS' => '+685',
		'SM' => '+378',
		'ST' => '+239',
		'SA' => '+966',
		'SN' => '+221',
		'RS' => '+381',
		'SC' => '+248',
		'SL' => '+232',
		'SG' => '+65',
		'SK' => '+421',
		'SI' => '+386',
		'SB' => '+677',
		'SO' => '+252',
		'ZA' => '+27',
		//'GS' => '',
		'ES' => '+34',
		'LK' => '+94',
		'SD' => '+249',
		'SR' => '+597',
		//'SJ' => '',
		'SZ' => '+268',
		'SE' => '+46',
		'CH' => '+41',
		'SY' => '+963',
		'TW' => '+886',
		'TJ' => '+992',
		'TZ' => '+255',
		'TH' => '+66',
		'TG' => '+228',
		'TK' => '+690',
		'TO' => '+676',
		'TT' => '+1',
		'TN' => '+216',
		'TR' => '+90',
		'TM' => '+993',
		'TC' => '+1',
		'TV' => '+688',
		'UG' => '+256',
		'UA' => '+380',
		'AE' => '+971',
		'GB' => '+44',
		'US' => '+1',
		'UM' => '+808',
		'UY' => '+598',
		'UZ' => '+998',
		'VU' => '+678',
		'VE' => '+58',
		'VN' => '+84',
		'VG' => '+1',
		'VI' => '+1',
		'WF' => '+681',
		//'EH' => '',
		'YE' => '+967',
		'ZM' => '+260',
		'ZW' => '+263'
		);

		return $dialCodes;
	}
}
